package com.saul.datastructure.stackandqueue;

/**
 * @author 罗泽民
 * @description
 * @date 2020/11/15 18:40
 */
public class Test {
    public static void main(String[] args) {
//        Mystack mystack = new Mystack(3);
//        mystack.push(1);
//        mystack.push(2);
//        mystack.push(3);
//        System.out.println(mystack.toString());
//        System.out.println(mystack.pop());
//        System.out.println(mystack.pop());
//        System.out.println(mystack.pop());
//        System.out.println(mystack.toString());

//        MyQueue myQueue = new MyQueue(3);
//        myQueue.insert(1);
//        myQueue.insert(2);
//        myQueue.insert(3);
//        System.out.println(myQueue.isEmpty());
//        System.out.println(myQueue.isFull());
//        System.out.println(myQueue.peek());
//        while (!myQueue.isEmpty()) {
//            System.out.println(myQueue.remove() + "  ");
//        }
//        myQueue.insert(21); //这里会出现异常.是因为我们在insert方法里面没有让front复原.front大小已经超过了数组的大小了


        MyCycleQueue myCycleQueue = new MyCycleQueue(3);
        myCycleQueue.insert(1);
        myCycleQueue.insert(2);
        myCycleQueue.insert(3);
        System.out.println(myCycleQueue.isEmpty());
        System.out.println(myCycleQueue.isFull());
        System.out.println(myCycleQueue.peek());
        while (!myCycleQueue.isEmpty()) {
            System.out.println(myCycleQueue.remove() + "  ");
        }
        myCycleQueue.insert(21);
        System.out.println(myCycleQueue.remove() + "  ");
    }
}
